<%@ page contentType="text/html; charset=utf-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %>
<%@ taglib prefix="primus" tagdir="/WEB-INF/tags" %>
<%@ taglib prefix="primus_form" tagdir="/WEB-INF/tags/form" %>
<%@ taglib prefix="primus_btn" tagdir="/WEB-INF/tags/btn" %>
<primus:page title="优惠券类型">
    <jsp:attribute name="css">
        <style type="text/css">
            #cat-table .name {
                min-width: 150px;
            }
        </style>
    </jsp:attribute>
    <jsp:attribute name="script">
    </jsp:attribute>
    <jsp:body>
        <div class="breadcrumbs ace-save-state" id="breadcrumbs">
            <ul class="breadcrumb">
                <li>
                    <i class="ace-icon fa fa-home home-icon"></i>
                    <a href="welcome.do">
                        首页
                    </a>
                </li>
                <li>
                    运营管理
                </li>
                <li class="active">
                    优惠券类型列表
                </li>
            </ul>
        </div>

        <div class="page-content">
            <div class="row">
                <div class="col-xs-12">
                    <!-- PAGE CONTENT BEGINS -->
                    <div class="row">
                        <div class="col-xs-12">
                            <h3 class="header smaller lighter blue">
                                优惠券类型列表
                                <span class="hidden-sm hidden-xs btn-group pull-right">
                                    <a href="management/couponType/new.do"
                                       class="btn btn-sm btn-primary"><i
                                            class="ace-icon glyphicon glyphicon-plus"></i>
                                        添加
                                    </a>
                                </span>
                            </h3>

                            <form action="management/couponType.do">
                                <div class="col-xs-12">
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label no-padding-right"
                                               for="coupon_type_search">优惠券类型名</label>
                                        <div class="col-sm-6">
                                            <input id="coupon_type_search" type="text"
                                                   name="couponTypeName" class="col-sm-10"/>
                                        </div>
                                        <div class="col-sm-3">
                                            <button type="submit" class="btn btn-sm btn-primary">
                                                搜索
                                            </button>
                                        </div>
                                    </div>
                                </div>
                            </form>
                            <br/>
                            &nbsp;
                            <table id="cat-table" class="table table-bordered table-hover">
                                <thead>
                                <tr>
                                    <th class="name">类型名</th>
                                    <th>使用范围</th>
                                    <th>发放数量</th>
                                    <th>创建人</th>
                                    <th>创建日期</th>
                                    <th>操作</th>
                                </tr>
                                </thead>
                                <tbody>
                                <c:forEach items="${page.content}" var="couponType">
                                    <tr>
                                        <td><c:out value="${couponType.couponTypeName}"/></td>
                                        <td><c:out value="${couponType.couponScopeType.desc}"/></td>
                                        <td><c:out value="${couponType.totalQuantity}"/></td>
                                        <td><c:out value="${couponType.creator}"/></td>
                                        <td><fmt:formatDate value="${couponType.createTimestamp}" pattern="yyyy年M月d日" /></td>
                                        <td><button type="button" class="btn btn-sm btn-primary">操作</button></td>
                                    </tr>
                                </c:forEach>
                                </tbody>
                            </table>
                            <primus:springPagePagination url="management/couponType.do" springPage="${page}"/>
                        </div><!-- /.span -->
                    </div><!-- /.row -->
                    <!-- PAGE CONTENT ENDS -->
                </div><!-- /.col -->
            </div><!-- /.row -->
        </div>
    </jsp:body>
</primus:page>
